package com.lin.community_thumb_sys.common;

import lombok.Getter;

/**
 * @version 1.0
 * @Author linzixiong
 * @Data 2025/1/16  20:42
 * @description：TODO
 */
@Getter
public class BusinessException extends RuntimeException {
    /**
     * 错误码
     */
    private final int code;

    public BusinessException(int code, String message) {
        super(message); //子类在写有参构造的时候需要用super调用父类的有参构造
        this.code = code;
    }

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.code = errorCode.getCode();
    }

    public BusinessException(ErrorCode errorCode, String message) {
        super(message);
        this.code = errorCode.getCode();
    }

}
